prepare-root: Init composefs options earlier
authorColin Walters <walters@verbum.org>
Mon, 21 Aug 2023 21:11:32 +0000 (17:11 -0400)
committerColin Walters <walters@verbum.org>
Fri, 25 Aug 2023 19:22:21 +0000 (15:22 -0400)
Prep for a later patch.

src/switchroot/ostree-prepare-root.c

index 50ea0e92fb45dea219b3f3191a850e7c2cae330c..682e71ea82352af0920b8b4aea633daa61414cd5 100644 (file)
@@ -436,6 +436,11 @@ main (int argc, char *argv[])
         1,
       };
 
+      cfs_options.flags = LCFS_MOUNT_FLAGS_READONLY;
+      cfs_options.image_mountdir = OSTREE_COMPOSEFS_LOWERMNT;
+      if (mkdirat (AT_FDCWD, OSTREE_COMPOSEFS_LOWERMNT, 0700) < 0)
+        err (EXIT_FAILURE, "Failed to create %s", OSTREE_COMPOSEFS_LOWERMNT);
+
       g_autofree char *expected_digest = NULL;
 
       if (composefs_config->is_signed)
@@ -476,11 +481,6 @@ main (int argc, char *argv[])
           ot_bin2hex (expected_digest, cfs_digest_buf, g_variant_get_size (cfs_digest_v));
         }
 
-      cfs_options.flags = LCFS_MOUNT_FLAGS_READONLY;
-      cfs_options.image_mountdir = OSTREE_COMPOSEFS_LOWERMNT;
-      if (mkdirat (AT_FDCWD, OSTREE_COMPOSEFS_LOWERMNT, 0700) < 0)
-        err (EXIT_FAILURE, "Failed to create %s", OSTREE_COMPOSEFS_LOWERMNT);
-
       if (expected_digest != NULL)
         {
           cfs_options.flags |= LCFS_MOUNT_FLAGS_REQUIRE_VERITY;